package cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.enums;

import java.util.Arrays;

/**
 * @Description 云签接口枚举
 * @Author caixh
 * @Date 2022/7/28.
 */
public enum CloudSignInterfaceEnum {
    addCompanyXbCert("/itp/yw/xb/addCompanyXbCert", "提交新办企业证书数据"),
    addPersonXbCert("/itp/yw/xb/addPersonXbCert", "提交新办个人证书数据"),
    certSeal("/itp/yw/xb/certSeal", "颁布新办证书印章"),
    currentXbState("/itp/yw/xb/currentXbState", "查询新办证书状态"),
    companyChange("/itp/yw/bg/companyChange", "提交企业变更数据"),
    doChange("/itp/yw/bg/doChange", "执行变更并开始制证制章"),
    queryChange("/itp/yw/bg/queryChange", "查询变更状态及变更数据"),
    addAuth("/itp/yw/bg/addAuth", "新增授权人"),
    changeAuth("/itp/yw/bg/changeAuth", "变更授权人"),
    queryAuth("/itp/yw/bg/queryAuth", "查询授权人"),
    doDelayCert("/itp/yw/yq/doDelayCert", "延期证书"),


    contractUpload("/itp/common/file/upload", "上传签署文件"),
    contractPush("/itp/yw/contract/push", "推送签署数据"),
    contractPushData("/itp/yw/contract/pushData", "新版推送签署数据"),
    contractGetUrl("/itp/yw/contract/getUrl", "获取签署url"),
    contractQuery("/itp/yw/contract/query", "查询签署情况"),
    contractDown("/itp/yw/contract/download", "下载签署文件"),

//    2.2.合同签署接口（无UI）：

    listByMobile("/itp/yw/sms/auth/listByMobile", "根据手机号获取证章列表"),
    getAuthSMS("/itp/yw/sms/auth/getAuthSMS", "发送用户授权短信验证码"),
    getAuthToken("/itp/yw/sms/auth/getAuthToken", "验证验证码获取授权token"),
    stamp("/itp/yw/pdf/server/stamp", "授权令牌PDF自动签章接口"),
    ;

    private String url;
    private String desc;

    CloudSignInterfaceEnum(String url, String desc) {
        this.url = url;
        this.desc = desc;
    }

    public String getUrl() {
        return url;
    }


    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return String.format("%s:%s", this.url, this.desc);
    }

    public static CloudSignInterfaceEnum resolve(String enumName) {
        return Arrays.stream(values()).filter(o -> o.name().equals(enumName)).findFirst().orElseThrow(() -> new RuntimeException("暂不支持接口[" + enumName + "]类型"));
    }
}

